//#include<bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;

int su[1000005], cnt = 0;
bool vis[1000005];

void o_init(int n) {
	n = sqrt(n) + 1;
	for (int i = 2;i <= n;i++) {
		if (vis[i] == false)
			su[++cnt] = i;
		for (int j = 1;j <= cnt&&su[j] * i <= n;j++) {
			vis[su[j] * i] = true;
			if (i % su[j] == 0)
				break;
		}
	}
	return;
}

int main()
{
	int n;
	cin >> n;
	o_init(n);
	for (int i = 1;i <= cnt-1;i++) {
		if (n % su[i] == 0)
		{
			cout << n / su[i] << endl;
			break;
		}
	}
	return 0;
}